Mcp app 2#17
Conversation
The Logger class and tsp submodule wrote to sys.stdout, corrupting the JSON-RPC transport when running as an MCP server over stdio. - Logger: write to sys.stderr instead of sys.stdout - tsp submodule: error prints go to sys.stderr This patch was made with claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Remove verbose debug logging (_log, _safe_tool decorator) and simplify run_cli error handling. Add _StderrWithBuffer class that redirects sys.stdout text writes to stderr while preserving .buffer for MCP's binary stdio transport. this code was made with the assistance of claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Rewrite the plot tool to produce JSON series data for MCP Apps iframe rendering, with as_image=True (default) returning a PNG via matplotlib. When as_image=False, returns self-contained HTML with Plotly bundled inline for sandboxed iframe rendering. - Add as_image parameter (default True) for PNG output - Return inline HTML with bundled Plotly when as_image=False - Add MCP Apps ui:// resource for interactive iframe chart - Improve docstring to reduce LLM hallucination on parameter usage - CLI: default resample-freq/min-size to None so module defaults apply - ML modules: simplify _process to inline preprocessing, pass min_size as explicit kwarg This code was written with the assistance of claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Add ToolAnnotations(readOnlyHint=True, destructiveHint=False) to all query tools so MCP clients can auto-approve them without user confirmation. Improve list_experiments docstring to guide LLMs toward resolving experiment names to UUIDs. This code was generated with the assistance of claude opus 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Add experiment:// resource template and dynamic list_resources override that enumerates all open experiments from the trace server, allowing MCP clients to browse experiments without calling tools. This code was was generated with claude sonnet 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
kavehshahedi
left a comment
There was a problem hiding this comment.
LGTM!
Just a point of discussion; As the MCP is now evolving, I feel that it might be decoupled from the tmll repository itself, and be moved to an independent repo (e.g., eclipse-tmll/tmll-mcp). As currently the MCP is evolving rapidly, and also, introducing new codes/features/etc., developing it in its own environment might be cleaner.
What do you think, Matthew?
| def get_experiment_resource(experiment_id: str) -> str: | ||
| """Return details for a specific experiment.""" | ||
| return run_cli("list") |
There was a problem hiding this comment.
Why the experiment_id was not used here? I mean, does the run_cli("list") return the info for the currently loaded experiment?
There was a problem hiding this comment.
I may or may not have been multi-tasking too hard. thanks for the catch!
Add experiment:// resource template and dynamic list_resources override that enumerates all open experiments from the trace server, allowing MCP clients to browse experiments without calling tools. This code was was generated with claude sonnet 4.6 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
…er reference Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Needs mcp inspector. Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Adds a CLI command and MCP tool that: - Takes a dict of series names to (event, field) pairs - Generates a Trace Compass XML analysis with stateProvider and xyView - Posts it to the server via the configuration API - Is destructive-idempotent (deletes existing config before re-posting)
|
Regarding tmll-mcp, it is interesting, When mcp spreads out of the /mcp folder, we can consider it. |
What it does
Overhauls the MCP server to be production-ready for MCP stdio transport and adds several new capabilities:
How to test
Start the trace server: python tmll/mcp/server.py tmll/mcp/cli.py
Use the MCP inspector to verify tools work without stdout corruption:
npx @modelcontextprotocol/inspector python3 tmll/mcp/server.py tmll/mcp/cli.py
Verify read-only tools show readOnlyHint: true in tool annotations.
Test plot_xy_with_anomalies:
- With as_image=True (default): should return a PNG image.
- With as_image=False: should return JSON with { "type": "html", "html": "..." }.
Verify list_resources returns open experiments as experiment:// resources.
Run the CLI directly to confirm detect-anomalies works without explicit --resample-freq:
python tmll/mcp/cli.py detect-anomalies -k "cpu usage"
Follow-ups
Review checklist